<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script type="text/javascript" src="qwebchannel.js"></script>
    <title>天地图加载</title>
</head>
<body>
    <div id="map" class="map">hello word!</div>
    <input type="button" value="点我试一试" id="btn" onclick="btnAction()"/>
</body>
<script type="text/javascript">
    window.onload = function () {
        clannel = new QWebChannel(qt.webChannelTransport, function (channel) {
            window.HostApplication = channel.objects.HostApplication;
            HostApplication.recieveJsMessage("hello Qt!")
        });
    }
    function sleep(delay) {
        var start = (new Date()).getTime();
        while ((new Date()).getTime() - start < delay) {
            continue;
        }
    }

    function add(a,b) {
        console.log('input', a, b)
        sleep(3000);
        return parseInt(a) + parseInt(b);
    }
    function btnAction() {
        HostApplication.recieveJsMessage("============")
    }
</script>
</html>